package com.chase.passwordmaster.mine

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.chase.passwordmaster.R
import com.chase.passwordmaster.config.APP_UPDATE_URI
import com.chase.passwordmaster.utils.useDarkStatusBar
import com.chase.passwordmaster.utils.useImmersingNavigator

class AboutActivity : AppCompatActivity() {
    companion object {
        fun actionStart(context: Context) {
            val intent = Intent(context, AboutActivity::class.java)
            context.startActivity(intent)
        }
    }

    private lateinit var cpBack: View

    private lateinit var cpUpdate: View

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_about)

        useDarkStatusBar()
        useImmersingNavigator()

        cpBack = findViewById(R.id.back_about)

        cpUpdate = findViewById(R.id.update_about)

        cpBack.setOnClickListener { onBackPressed() }

        initCPUpdate()
    }

    private fun initCPUpdate() {
        cpUpdate.setOnClickListener {
            val uri = Uri.parse(APP_UPDATE_URI)
            val intent = Intent()
            intent.action = "android.intent.action.VIEW"
            intent.data = uri
            startActivity(intent)
        }
    }
}